package acceptance;

import junit.framework.Assert ;
import presentation.UIPost ;
import presentation.UIThread ;




/**
 * @author reut
 * tests different parameters of searching for message
 * IMPORTANT:in order to work these conditions need to hold:
 *  registered and logged in: username: dani,password:1234
 *  dani posted message: hello this is a test message fron dani
 */
public class SearchForMessageByCategoriesTest extends ProjectTest
{
	@Override
	public void setUp(){
		super.setUp();
		this._bridge.register("dani", "1234");
		this._bridge.login("dani", "1234");
		UIThread t = this._bridge.createNewThread("topic1", 2) ;
		Assert.assertNotNull(t) ;
		UIPost p = this._bridge.addPost(t.getId(),"hello this is a test message fron dani",2) ;
		Assert.assertNotNull(p) ;

	}

	/**
	 * tests cases of successful search
	 */
	public void testCorrectLogin()
	{

		Assert.assertTrue("search was succssesfuly", this._bridge.searchForMessageByCategories("dani", "hello this is a test message fron dani"));

	}



	/**
	 *  tests if there is no message this authoe wrote
	 */
	public void testNoMessageExistForAuthorName(){

		Assert.assertFalse("authorname not found", this._bridge.searchForMessageByCategories("mimi", "msg1"));
	}

}
